package com.google.code.bankagregator.adapter.bank.alpha.parser.credit;

import com.google.code.bankagregator.adapter.bank.alpha.parser.FuncForCredParsers;
import com.google.code.bankagregator.adapter.exception.AdapterConnectException;
import com.google.code.bankagregator.entities.Credit;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: kirill
 * Date: 15.06.13
 * Time: 18:18
 * To change this template use File | Settings | File Templates.
 */
public class AlphaAutoCreditParser {
    private static final int INDEX_FOR_TEN_RATE = 1;
    private static final int INDEX_TR_FOR_RATE = 2;
    private static final int INDEX_TD_FOR_TEN_RATE = 0;

    private static final int INDEX_FOR_TWENTYFIVE_RATE = 2;
    private static final int INDEX_TD_FOR_TWENTYFIVE_RATE = 1;

    private static final int INDEX_FOR_FIFTY_RATE = 3;
    private static final int INDEX_TD_FOR_FIFTY_RATE = 2;

    private static final int INDEX_FOR_SIXTY_RATE = 4;
    private static final int INDEX_TD_FOR_SIXTY_RATE = 3;

    /**
     * Get credit`s params for the auto credit where prepayment = 10%
     *
     * @return credit`s params
     * @throws com.google.code.bankagregator.adapter.exception.AdapterConnectException
     *
     */
    public List<Credit> getAutoCreditTenPrep() throws AdapterConnectException {
        List<Credit> creditParam = new FuncForCredParsers().
                parser(INDEX_FOR_TEN_RATE, INDEX_TR_FOR_RATE, INDEX_TD_FOR_TEN_RATE);
        return creditParam;
    }

    /**
     * Get credit`s params for the auto credit where prepayment = 25%
     *
     * @return credit`s params
     * @throws AdapterConnectException
     */
    public List<Credit> getAutoCreditTwentyFivePrep() throws AdapterConnectException {
        List<Credit> creditParam = new FuncForCredParsers().
                parser(INDEX_FOR_TWENTYFIVE_RATE, INDEX_TR_FOR_RATE, INDEX_TD_FOR_TWENTYFIVE_RATE);
        return creditParam;
    }

    /**
     * Get credit`s params for the auto credit where prepayment = 50%
     *
     * @return credit`s params
     * @throws AdapterConnectException
     */
    public List<Credit> getAutoCreditFiftyPrep() throws AdapterConnectException {
        List<Credit> creditParam = new FuncForCredParsers().
                parser(INDEX_FOR_FIFTY_RATE, INDEX_TR_FOR_RATE, INDEX_TD_FOR_FIFTY_RATE);
        return creditParam;
    }

    /**
     * Get credit`s params for the auto credit where prepayment = 60%
     *
     * @return credit`s params
     * @throws AdapterConnectException
     */
    public List<Credit> getAutoCreditSixtyPrep() throws AdapterConnectException {
        List<Credit> creditParam = new FuncForCredParsers().
                parser(INDEX_FOR_SIXTY_RATE, INDEX_TR_FOR_RATE, INDEX_TD_FOR_SIXTY_RATE);
        return creditParam;
    }
}
